Method for determining the numerical value for the duration of a periodically repeated pulse signal, and device for carrying out said method

ABSTRACT

The invention concerns a method for determining a numerical value for the duration of a periodically repeating pulsed signal. This method comprises the following steps: a) at time intervals, the period length of the signal is determined; b) at time intervals, a characteristic magnitude for the length of a pulse of that signal is determined; c) a numerical value that characterizes the signal is ascertained from the period length and the characteristic magnitude. Because of its shortness and accuracy, the method is particularly suitable for use in electric motors. A corresponding arrangement is also presented and described.

[0001] This application is a §371 of PCT/EP02/07204, filed 29 Jun. 2002and published 13 Feb. 2003 as WO 03-012971-A.

FIELD OF THE INVENTION

[0002] The invention concerns a method for determining a numerical valuefor the duration of a periodically repeating pulsed signal, and anapparatus for carrying out such a method.

BACKGROUND

[0003] In the context of controlling the rotation speed of electricmotors, a so-called rated speed signal is usually specified to arotation speed controller, i.e. the rotation speed controller isinstructed by means of a suitable signal that the motor is to run at,for example, 32,246 or at 1100.5 rpm.

[0004] That rated speed signal can be, for example, a voltage between 0and 5 V, or a frequency, or the ratio between signal length and periodlength (also called the pulse duty factor) in the case of a periodicallyrecurring signal as depicted at 68 in FIG. 5. A signal of this kind thenhas a specific frequency that will usually lie somewhere between 2000and 5000 Hz, and the magnitude of the pulse duty factor, which can liebetween 0% and 100%, indicates to the rotation speed controller thespeed at which the motor is to run at that moment; for example, a pulseduty factor of 0% can mean that the motor is stationary, and 100% canmean a high rotation speed.

[0005] Microprocessors (μP) or microcontrollers (μC) are often used forthe control and regulation of such motors, the term “microprocessor”(μP) being used in the claims as a general term for both. A μP of thiskind usually controls the commutation of the motor—assuming the latteris an electronically commutated motor (ECM)—and it also serves toregulate the rotation speed and to perform other functions asapplicable.

[0006] A μP of this kind requires as a target value for its controller anumerical value, e.g. “37” or “214”; in other words, in a signal of thekind described above, the ratio of signal length to period length, orthe ratio of signal off-time to period length, must be converted into asuitable numerical value that lies, for example, in the numerical rangefrom 0 to 255 or 0 to 1023. This requires that both the period lengthand the signal length be sensed as accurately as possible, to the extentpossible with an inexpensive μP such as those used for cost reasons inmotors.

SUMMARY OF THE INVENTION

[0007] It is therefore an object of the invention to provide a novelmethod for determining a numerical value for the duration of aperiodically repeating pulsed signal, and an apparatus for carrying outsuch a method.

[0008] According to the invention, this object is achieved by thesubject matter of claim 1. Because the period length and thecharacteristic magnitude are ascertained at time intervals, those valuescan be ascertained sequentially and then processed further. This allowsthe measurement to be split up into relatively short routines that canbe executed at suitable points in time, preferably at specificrotational positions of the rotor of a motor.

[0009] It is particularly advantageous in this context to proceed inaccordance with claim 2, i.e. the type of measurement accomplished isdependent on a previously determined numerical value for the pulse dutyfactor of the signal. This permits an optimization of the measurement.

[0010] A particularly advantageous embodiment of an optimizedmeasurement of this kind is the subject matter of claims 3 and 4. Thistype of measurement of the pulse duration can be performed provided apulse is long with respect to the period length; and a measurement ofthe off-time length between two pulses can be performed provided thepulse duration is short and the off-time length is consequently long inrelation to the period length.

[0011] A particularly advantageous embodiment is the subject matter ofclaim 5, since a switching hysteresis is obtained here so that frequentswitching between the various measurement types, which might reducemeasurement accuracy, does not occur.

[0012] A further approach to achieving the stated object is the subjectmatter of claims 13 and 14, yielding very simple and fast-workingsolutions.

BRIEF FIGURE DESCRIPTION

[0013] Further details and advantageous developments of the inventionare evident from the exemplary embodiments, which in no way are to beunderstood as a limitation of the invention, that are described belowand depicted in the drawings.

[0014]FIG. 1 is an overview circuit diagram for an electronicallycommutated motor 30 to which is conveyed, from outside, a periodic pulsetrain 68 whose pulse duty factor contains a datum for operation of themotor;

[0015]FIG. 2 is a schematic diagram showing interactions in a motoraccording to FIG. 1;

[0016]FIG. 3 is an overview depiction of a preferred program sequence inthe motor according to FIGS. 1 and 2;

[0017]FIG. 4 schematically depicts the processes occurring in the motoraccording to FIG. 1 as a function of the rotational position of therotor;

[0018]FIG. 5 depicts a first pulse train having periodically recurringpulses of period length T and a pulse duty factor of approx. 33%;

[0019]FIG. 6 is a depiction similar to FIG. 5 with the same periodlength T but very short pulses and a pulse duty factor of approx. 5%;

[0020]FIG. 7 is a depiction similar to FIGS. 5 and 6 with the sameperiod length T but with very long pulses and a pulse duty factor ofapprox. 93%;

[0021]FIG. 8 is a depiction in which the signal is continuously high andconsequently has a pulse duty factor of 100%;

[0022]FIG. 9 is a depiction in which the signal is continuously low andconsequently has a pulse duty factor of 0%;

[0023]FIG. 10 is a diagram to explain the interrupts that occur innormal circumstances upon measurement of a pulse 69;

[0024]FIG. 11 is a diagram to explain the situation in which a pulse isso short that an interrupt is possible only at the beginning of thepulse, but not at the end of the pulse;

[0025]FIG. 12 is a diagram to explain the situation in which a pulseoff-time is so short that an interrupt is possible only at itsbeginning, but not at its end;

[0026]FIG. 13 depicts a state machine preferably used in the context ofthe invention;

[0027]FIG. 14 depicts the basic processes in the context of themeasurement and evaluation of pulses;

[0028]FIG. 15 is an expanded version of FIG. 14 showing the evaluationof special cases (PWM=0% or 100%) and the handling of errors;

[0029]FIG. 16 is a diagram showing basic processes that are recorded andcontrolled by the state machine;

[0030]FIG. 17 is a diagram showing how the various states of the statemachine are cycled through in normal circumstances;

[0031]FIG. 18 is a flow chart of an interrupt routine that is triggeredby a settable edge of a signal;

[0032]FIG. 19 is a flow chart of a “Meas. Signal” measurement routinewhich serves to determine the duration of pulsed signals or signaloff-times; and

[0033]FIG. 20 is a flow chart of an EVAL routine which serves toevaluate the data sensed in the routine according to FIG. 19.

DETAILED DESCRIPTION

[0034]FIG. 1 shows, in order to illustrate the invention, anelectronically commutated motor (ECM) 30 having two stator windingphases 32, 34 and a permanent-magnet rotor 36 which is depicted here ashaving four poles and in whose vicinity is arranged a Hall generator 38that, in operation, generates at its output 40 a rectangular HALL signalwhose edges are labeled, for example, 1, 2, 3, 4.

[0035] Motor 30 has an EMI filter 42 and a filter capacitor 44 fordelivery of a DC voltage U_(B). A transistor 46 that serves as a firstoutput stage (PS1) is connected in series with phase 32, and atransistor 48 that serves as a second output stage (PS2) is connected inseries with phase 34. When transistor 46 is switched on, phase 32receives current. When transistor 48 is switched on, phase 34 receivescurrent.

[0036] A microcontroller (μC) 54 serves to control transistors 46, 48.Various modules are depicted symbolically in this microcontroller,including a module 56 for commutation, a ROM 62 (inside or outside μC54) to store the program for motor 30, a module n_CTL 64 for rotationspeed regulation that regulates the rotation speed of motor 30 viamodule 56, and also a module SW_CALC 60 for calculating target value SWthat is conveyed to controller 64. The present value of the rotationspeed is conveyed in the form of the HALL signal to controller 64, andalso to modules 56 and 64. AC 54 further contains a timer 66, which maybe thought of as a clock that furnishes, for each desired point in time,a so-called baseline time. This timer coacts with modules 60 and 64.

[0037] As shown in FIG. 1, a target value is conveyed from outside to μC54, at an input 67, as a periodic pulse train 68; and the informationconcerning the desired rotation speed (SW) is contained in the pulseduty factor of pulses 68. This is explained below in further detail.

[0038] As is evident from FIG. 1, μC 54 must process two different pulsetrains namely, on the one hand, the HALL pulse train and, on the otherhand, pulse train 68. Since the HALL pulse train is critical foroperation of the motor, its processing usually takes precedence over theprocessing of pulse train 68, except that at certain critical juncturesthe processing of pulse train 68 must not be interrupted, and pulsetrain 68 then takes precedence.

[0039]FIG. 2 shows the manner in which the individual functionsintermesh in the context of such a motor. Pulse train 68 is delivered at68, and is processed in module 60 to yield the value SW. The ON/OFFsignals for switching motor 30 on or off are delivered at 72, and theyalso pass through module 60. At 74, operating voltage UB is delivered;this can be taken into account, for example, in such a way that themotor is switched off if the operating voltage is too low, or so thatcertain changes in the program are made if the operating voltage is toohigh. Hall IC 38 that generates the HALL signal is depicted at 38; thatsignal is processed in a processing module 76 and furnishes informationabout the instantaneous position and rotation speed of rotor 36.

[0040] Lastly, commutation module 56 that controls the two output stagesPS1, PS2 in motor 30 is provided.

[0041]FIG. 2 shows that there exist among the individual modulesinteractions that must be taken into account, as applicable, whenconfiguring the program to be used in an ECM.

[0042]FIG. 3 shows a typical basic structure of the program that is usedto control the various functions of motor 30. In step S84 (Power-oninitialize), at start-up an initialization is performed, in whichvarious parameters are set to initial values. In step S86 (Resetwatchdog) the computer's watchdog is reset, and in step S88(Re-initialize) a reinitialization of certain values is performed ateach pass in order to prevent μC 54 from crashing.

[0043] At S90 (Commutation control), the commutation is controlled, andin step S92 (Flag_DoFcts?), a flag is polled: if its value is 0, theprogram goes back to S86; if its value is 1, this flag is set to 0 instep S94 (Flag_DoFcts=0). The subsequent step S98 (Hall_CNT even?) askswhether the Hall counter is even or odd. This refers to the depiction ofthe HALL signal in FIG. 1. As depicted there, at each change in thissignal a counter is advanced by one value, for example in the sequence1-2-3-4-1-2-3-4; if the counter has an even value, then in S100 (Targetvalue sensing) a portion of the target value calculation SW_CALC isperformed, and then in step S102 (Flag_Actual Value_sensed=0) a flag forsensing the actual value is set to zero. The program then goes back tostep S86.

[0044] If the response in S98 is No, the program goes to step S104(Flag_Actual Value_sensed?) which inquires whether the flag for theactual value has a value of 1 or 0. If its value is 1, the program thengoes to step S106 (Target value sensing) where a portion of the SW_CALCcalculation is performed; and if the response in S104 is 0, the presentrotation speed is then sensed in S108 (Actual value sensing) byevaluating the HALL signal. In S112 (Flag_Actual Value_sensed=1), theflag for the actual value is then set to 1 in order to indicate that theactual value has been sensed and that step S106 (target valuecalculation) can be performed at the next pass through S104.

[0045] The diagram shows that calculation of the target value isdistributed between steps S100 and S106 since calculation of the targetvalue requires quite a lot of time and, without that distribution, wouldnot be compatible with the other functions of the motor.

[0046]FIG. 4 is an overview depicting the sequence of program steps inmotor 30 as a function of the rotational position of rotor 36. Anelectric motor that is controlled by a μC 54 can have numerousadditional functions depending on how it is used, e.g. rotation speedregulation, rotation speed limitation, current limitation, regulation toconstant current, arrangements for outputting alarm signals, errorhandling routines, etc.

[0047] In the present exemplary embodiment, the rotation speed of motor30 is regulated to a target value, e.g. to 3000 rpm. That target valuemust therefore be updated for the control program at relative frequentintervals.

[0048] A knowledge of the motor's instantaneous rotation speed, e.g.2990 rpm, is also necessary for rotation speed regulation. This actualvalue of the rotation speed must also be updated at relatively frequentintervals.

[0049] In addition, certain parameters must be reinitialized from timeto time in order to ensure stable motor operation, and μC 54 must switchthe current to motor 30 on and off, in accordance with the calculationsof the rotation speed controller and also switch over the direction ofthe motor current depending on the instantaneous rotational position.All these operations are referred to in electrical engineering as“commutation.” This should be accomplished with great precision, since amotor runs quietly only if the commutation instructions are executedvery exactly. This means that the program must check very frequentlywhether a program instruction for commutation is present and needs to beexecuted.

[0050]FIG. 4a shows the profile of the HALL signal, and FIG. 4bsymbolically shows the loops through which the program passes.

[0051] As shown in FIG. 4, immediately after an edge 120, 122 of theHALL signal there is a large calculation loop 124, 126, 128 (FIG. 3) inwhich longer calculation procedures are performed depending on the valueof counter HALL_CNT, and then there are many short calculation loops 130in which commutation is merely checked and, if applicable, controlled.Since these short loops 130 contain very few steps and therefore followone another very closely, they result in high resolution; in otherwords, every 60 to 100 μs the program checks whether anything needs tobe modified in terms of commutation.

[0052]FIG. 4 shows that, for example, directly after a rising edge 120of the HALL signal, a long loop 124 is executed in which, as shown inlegend 134, the target value (SW) for regulating the rotation speed iscalculated and the commutation is also checked. Large loop 124 isfollowed by many short loops 130 in which, as shown in legend 136,commutation is simply checked and modified if necessary.

[0053] In this example, a falling edge 122 of the HALL signal isfollowed by a long loop 126 in which, as shown in legend 138, thefollowing calculation steps are performed:

[0054] actual value calculation (IW)

[0055] commutation (Komm.).

[0056] This long loop 126 is once again followed by short loops 130 formonitoring and controlling commutation.

[0057] The next rising edge 120 of the HALL signal is once againfollowed by a long loop 124 of the kind already described. The result isthat certain values are ascertained in the region of each Hall edge 120,122, i.e. at certain rotor positions, so that, for example, in the caseof a four-pole rotor 36, in the course of one complete revolution, atarget value calculation is performed twice and an actual valuecalculation is performed twice. As is evident from FIG. 3, when counterHALL_CNT yields an “odd” result in step S98, either loop 126 or loop 128can be run through, depending on whether the flag at step S112 was setto 1 during the previous pass through that step. The calculationoperations are thus distributed in time, and the distribution iscontrolled by factors that include the position of rotor 36.

[0058] This rotor-position-dependent sensing of values is possible in amotor because the rotation speed usually changes only slightly in thecourse of one rotor revolution.

[0059]FIG. 5 is an enlarged depiction of signal 68 of FIG. 1, by meansof which controller n_CTL 64 is informed of the desired rotation speed.This signal 68 has pulses 69 and pulse off-times 70. Since it has aperiodic profile, it has a period length T that can be, for example, 1ms=0.001 s, and in that case signal 68 has a frequency of 1/0.001=1000Hz. The length of pulses 69 is labeled t, and the length of the pulseoff-times is labeled t′. Therefore

T=t+t′  (1).

[0060]FIG. 6 shows that pulses 69 can be very short, resulting in longpulse off-times 70; and FIG. 7 shows conversely that pulses 69 can bevery long and pulse off-times 70 consequently can be very short.

[0061] As shown in FIG. 8, signal 68 can also continuously have a HIGHvalue, which corresponds to a pulse duty factor of 100%; and conversely,according to FIG. 9 signal 68 can also continuously have a LOW value,corresponding to a pulse duty factor of 0%.

[0062] All the situations shown in FIGS. 5 through 9 must be correctlyinterpreted by the software. In the situations according to FIGS. 5through 7, period length T must be measured in every case. In thesituations of FIGS. 8 and 9, period length T is equal to infinity, andthat fact must be correctly interpreted by the program.

[0063] In the situation shown in FIG. 7, according to the presentinvention not only T but also the value t is measured, i.e. the lengthof pulses 69, which in this instance is not much less than T.

[0064] In FIG. 6, pulses 69 are very short and therefore difficult tomeasure, since pulse measurement is accomplished by measuring, by meansof timer 66 (FIG. 1), the point in time of the rising edge of a pulse bymeans of a first interrupt, and the point in time of the falling edge ofpulse 69 by means of a second interrupt, and ascertaining the differencebetween those two points in time. Since each interrupt requires acertain amount of time, e.g. 30 μs, this is difficult if pulse length tis very short, and the measurement then becomes very inaccurate orindeed impossible.

[0065] According to the invention, therefore, with short pulses 69 (asdepicted in FIGS. 5 and 6) time t′ for a pulse off-time is measured andcalculated, and the formula

t=T−t′(2)

[0066] is then used to calculate pulse length t indirectly from thattime.

[0067] Since pulses 69 are in all cases long when motor 30 is switchedon, a FlagPM (=pulse measurement) that defines the type of measurementis set, at the initialization after switching on, to FlagPM=1, whichmeans a measurement of pulse length t; the ratio t/T (or alternativelyt′/T) is then continuously monitored, and if the former ratio dropsbelow 46%, FlagPM is set to 0 in order to switch over to measurement ofthe duration t′ of pulse off-times 70.

[0068] Conversely, if FlagPM=0, the program checks whether the ratio t/Tbecomes greater than 51%, in which case FlagPM=1 is set and pulse lengtht is measured. The difference between 46 and 51% results in ahysteresis, i.e. at a ratio t/T of 50% either the pulse length or theduration of the pulse off-times is measured, and the type of measurementchanges only when the value either exceeds 51% or falls below 46%. Thenumbers 46 and 51 are, of course, merely examples indicated for bettercomprehension of the invention.

[0069]FIG. 10 and FIG. 11 explain a problem that occurs in themeasurement of pulses. FIG. 10 shows a pulse 69. The latter has a risingedge 144, and at a time previous to that edge, during a measurement ofpulse length t, the sensitivity of input 67 (FIG. 1) of μC 54 is set sothat the rising edge of a signal there triggers an interrupt 146 thatresults in a measurement of time t₀₁ in TIMER 66.

[0070] An interrupt comprises a plurality of instructions, and aninterrupt routine of this kind requires a certain length of time forexecution, ending e.g. at time t₀₂. Its duration is, for example,between 60 and 100 ps.

[0071] In FIG. 10, a check is made at time t₀₂ as to whether input 67 ishigh or low. In this case the input is high, i.e. pulse 69 has not yetended. At time t₀₂ the sensitivity of input 67 is therefore switchedover so that at the falling edge 148 that will then follow, an interrupt150 is triggered and results in measurement of time t₀₃ in timer 66.

[0072] The length of pulse 68 is then calculated (t=t₀₃−t₀₁). This istherefore a measurement in the context of pulses 69 that are longer thaninterrupt routine 146. The polling of input 67 at time t₀₂ confirms thatpulse 69 is still continuing, and therefore that its end cansubsequently be measured.

[0073]FIG. 11 shows the analogous situation for a very short pulse 69′that is shorter than interrupt routine 146, i.e. for example only 30 μs.In this case as well, prior to rising edge 144 the sensitivity of input67 is set so that at edge 144, an interrupt 146 is triggered and timet₀₁ is measured.

[0074] Here as well, in similar fashion, input 67 is polled at the endof interrupt routine 146 (i.e. at time t₀₂), and it is found that thisinput has a LOW value. This means that pulse 69′ has already ended, thatvalue t₀₃ therefore cannot be measured, and that it is necessary toswitch over to measurement of pulse off-time t′, i.e. FlagPM=0 is sethere, and this measurement is not evaluated.

[0075]FIG. 12 shows a situation analogous to FIG. 11, i.e. measuring avery short pulse off-time 70 whose length t′ is shorter than that of theinterrupt routine.

[0076] In this case the sensitivity of input 67 is set so that fallingedge 152 at the beginning of pulse off-time 70 triggers an interrupt 154which lasts longer than pulse off-time 70. That interrupt 154 ends attime t₀₅, and at that time the signal at input 67 is polled and is foundto be High at that time. This means that the pulse off-time has alreadyended and therefore cannot be measured. The measurement is thereforediscarded, and the setting is switched over to FlagPM=1, i.e.measurement of the pulse length. If, conversely, input 67 were low attime t₀₅ in FIG. 12, then pulse off-time 70 would not yet have ended andwould be measured by triggering, at the rising edge following fallingedge 152, a new interrupt with a time measurement.

[0077]FIG. 13 shows a so-called “state machine” that is used in thepresent exemplary embodiment. This is a variable, namely a register inthe RAM of μC 54, that here can assume values from 1 to 8. Depending onthe routine that is presently being executed, this register hasdifferent values that can be polled in the program. The individualstates of FIG. 13 have the following meanings:

[0078] State 1 “T_Start”. This means that the first interrupt forsensing period length T is expected.

[0079] State 2 “t1_Start”. This means that the first interrupt for pulsesensing (edge 144 of FIG. 10, edge 152 of FIG. 12) is expected. This cantherefore be both sensing of a pulse and sensing of a pulse off-time.

[0080] State 3 “T_End”. This means that the second interrupt for sensingperiod length T is expected, i.e. the interrupt at point 156 in FIG. 5.

[0081] State 4 “t1_End”. This means that the second interrupt forsensing the pulse length (interrupt 148 in FIG. 10), or the secondinterrupt for sensing the off-time length, is expected.

[0082] State 5 “T_Over”. This means that the sensing of period length Tis complete, and that sensing of pulse length t or sensing of off-timelength t′ now follows.

[0083] State 6 “t1_Over”. This means that sensing of the pulse length (tin FIG. 7) or sensing of the off-time length (t′ in FIG. 6) is complete,and that evaluation of the measured data now follows.

[0084] State 7 “Limit”. This means that signal 68 contains no edges, asdepicted in FIGS. 8 and 9, so that no interrupts are being generated.Signal 68 is then either statically High (FIG. 8) or statically Low(FIG. 9). This state is processed in steps S296 through S300 in FIG. 19,and SM=7 is therefore then set in S302.

[0085] State 8 “Error”. This means a sensing error in the sensing of thepulse length as described in FIG. 11, or a sensing error in the sensingof the off-time length as described in FIG. 12. In other words, only oneof the two interrupts pertaining to a measurement could be sensed, butan error occurred in the case of the second interrupt, as follows:

[0086] a) Either the pulse was too short, so that the second interruptcould not be sensed, as described with reference to FIGS. 11 and 12.This state is processed in FIG. 18 at S232, S234, S236, and S244. SM=8is then set in S238 or S246, and the measurement type is automaticallyswitched over (S242, S252 in FIG. 18).

[0087] b) Or the second interrupt came too late (after the Timeout inFIG. 19 had elapsed), so that once again it could not be sensed; SM=8 isthen set in FIG. 19, S294, and the measurement is discarded andrestarted.

[0088]FIG. 14 shows the general sequence of routine S160 (Digital PWMSensing). At S162 (Wait for period length starting edge “1”), theprogram is in state 1 and is waiting for the starting edge in order tomeasure period length T, i.e. edge 144 in FIG. 5.

[0089] At S164 (Wait for period length end “3”), the program is in state3 and is waiting for edge 156 (FIG. 5), i.e. the end of period length T.

[0090] At S166 (Period length successfully sensed “5”), the program thengoes into state SM=5, which means that period length T has beensuccessfully sensed.

[0091] At S168 (FlagPM=1?), the program polls the value of FlagPM. Ifthat value is 1, then at S170 (Wait for pulse width starting edge “2”)the program goes into state 2, i.e. waiting for the starting edge (144in FIG. 10) of a pulse 69.

[0092] The program then goes to S172 (Wait for pulse width end “4”),i.e. state 4, where it waits for edge 148 (FIG. 10), i.e. the end ofpulse 69.

[0093] The program then goes to S174 (Pulse width successfully sensed“6”), i.e. into state 6, meaning that pulse width t has beensuccessfully sensed.

[0094] If the response in S168 is No, then a measurement of off-timelength t′ is performed. In that case, in S176 (Wait for off-time lengthstarting edge “2”) the program goes into state 2, i.e. expectingstarting edge 152 (FIG. 12).

[0095] In S178 (Wait for off-time length end “4”) the program then goesinto state 4, where it waits for the end of the pulse off-time, e.g.edge 156 in FIG. 5.

[0096] In S180 (Off-time length successfully sensed “6”) the programthen goes into state 6, meaning the off-time length t′ has beensuccessfully sensed.

[0097] Subsequent to the sensing of pulse width t (S174) or off-timelength t′ (S180), the program goes to S182 (Calculations: pulse dutyfactor etc.) where the necessary calculations are performed, for examplecalculating the value t/T (which is referred to as the “pulse dutyfactor” of signal 68) or the frequency of signal 68 at output 67. Thisis followed by a Return in step S184.

[0098] The state machine according to FIGS. 13 and 14 is constructed sothat firstly period length T is sensed in states 1, 3, and 5, theneither pulse length t or off-time length t′ in states 2, 4, and 6, andthen the various calculations are performed in S182. The target valuemodule, shown in principle in FIG. 14, is therefore called in FIG. 3 atS100 and at S106, and it must be called a total of three times before anew valid target value exists. The reason for doing this is to dividethe calculation time for this module, which is fairly long, intomanageable smaller portions that do not interfere with the commutationof motor 30. If no consideration needs to be given to the commutation ofa motor, such a division is of course unnecessary.

[0099] As is evident from FIG. 14, data sensing is complete only afterthe processing of states 1-3-5 AND states 2-4-6. For example, if thestate machine (FIG. 13) is in state 1 or 2, then data sensing is not yetcomplete and a sensing function must be performed. The value of thestate machine is greater than 2 only when no further sensing needs to beperformed. Execution cannot leave the state machine if the value is 3 or4. It ends instead in one of the states 6, 7, or 8, since in S310, FIG.19 the state SM=5 is automatically switched over to SM=2 so that eitherpulse sensing or off-time sensing (depending on the value of FlagPM) canbe started at the next pass.

[0100]FIG. 14 shows only the basic structure of the measurementoperation. FIG. 15 is a somewhat more detailed depiction in which states7 and 8 are also shown. Steps S160 through S184 are identical to FIG.14, and will be labeled in the same way as therein and not describedagain.

[0101] If it is found in S162 that an edge cannot be measured within adetermined time (PWM pulse width is either 0% or 100%), then in S186(Limit signal without edges “7”) the program goes into state 7, i.e.either the situation according to FIG. 8 exists, and the pulse dutyfactor is then set to 100% in S182; or the situation according to FIG. 9exists, and in that case the pulse duty factor is set to 0% in S182.

[0102] If, in S164 (Wait for period length end “3”), the interrupt forthe end of period length T (interrupt 156 of FIG. 5) arrives too late ornot at all, the program then goes to S188 (Sensing error, secondinterrupt missing or too late “8”), i.e. into state 8. The measurementis discarded, and the program begins a new measurement at S162 (Wait forperiod length starting edge “1”) in state 1.

[0103] The same thing happens if, in S172 (Wait for pulse width end “4”)or S178 (Wait for off-time length end “4”), the second interrupt isabsent or comes too late. In this case as well, the measurement isdiscarded, the program goes back to the start at S162 (Wait for periodlength starting edge “1”) and begins a new measurement, and the previousmeasurement continues to be used until a new one is available.

[0104]FIG. 16 shows the simple basic structure of the program that canbe achieved using the state machine. After the beginning S194, step S196polls for the existence of state 8 (Error), which is depicted in FIG. 15at S188 and described there. If an error is present, the measurement isdiscarded and a new measurement begins, i.e. at S198 the program goes tostate SM=1 of the state machine and waits for the starting edge formeasurement of period length T, labeled S162 in FIG. 15.

[0105] If no error is identified in step S196, the program goes to stepS200 and asks whether a state greater than 2 is present. A state of 1 or2 means that at least one of the measurements still needs to be startedand that consequently the measurement of signal 68 is not yet complete;if the response is No, measurement of the signal is therefore performedin module S202 (FIG. 19). If the response in S200 is Yes, however, thismeans that no further measurement needs to be started, and the measureddata are then evaluated in the subsequent module S204 EVAL (FIG. 20).Module S202 or S204 is followed by step S206 (Return).

[0106] As already explained, the state machine cannot be left at valuesSM=3 or 4 but instead must always end in one of states 6, 7, or 8, sothat values greater than 2 mean that the measurements are complete.

[0107]FIG. 17 shows the procedure for measuring the target value thatresults from the program of FIG. 16.

[0108] With rotor 36 at a rotational position I, the program begins atstate SM=1, passes through states 3 and 5 (i.e. measurement of periodlength), and halts at state SM=2 of the state machine, as depicted atS310 of FIG. 19.

[0109] With rotor 36 at a rotational position II, query S200 in FIG. 16generates a No response because the state machine initially has a valueof 2, and states 2, 4, and 6 are now cycled through, i.e. either thesignal length or the off-time length is measured. At the end of thismeasurement, the state machine halts at SM=6.

[0110] With rotor 36 at a rotational position III, query S200 of FIG. 16yields a response of Yes (Y), and evaluation (EVAL) of the data inmodule S204 (FIG. 20) then follows. The state machine then goes intostate SM=1 (S334 in FIG. 20). This occurs in step S334 of FIG. 20. Fromthere the cycle then begins afresh, as indicated by the dashed line inFIG. 17.

[0111] In this fashion, calculation of the target value can bedistributed in time over several rotational positions. In each normalcycle, the left branch S202 (signal measurement) in FIG. 16 is runthrough twice, and the right branch S204 (EVAL) only once.

[0112] This is controlled by Hall counter HALL_CNT in S98 of FIG. 3,which is advanced at each edge of the HALL signal and continuouslycycles through the values 0 through 7. A four-pole rotor 36 results infour edges of the HALL signal for each revolution. The pattern is then:HALL_CNT Path Sensing of 0 124 Target value 1 128 Target value 2 124Target value 3 126 Actual value 4 124 Target value 5 128 Target value 6124 Target value 7 126 Actual value

[0113] A new target value and a new actual value are thus obtained hereafter each revolution, i.e. 60 times per second at 60 revolutions persecond.

[0114]FIG. 18 shows interrupt routine S210 that is triggered by an edgeof signal 68. In step S212 (Interrupt sensitivity=rising edge), μC 54 isset so that it reacts with an interrupt to a rising signal edge (e.g.144 in FIG. 5) at its input 67. A flag for the interrupt is thencanceled in S214, and at S216 the present value of timer 66 is copiedinto a 16-bit variable PWM_End.

[0115] S218 then identifies which of the interrupts has arrived. This isdone by checking whether SM is less than 3. If Yes, this implies eitherSM=1 or SM=2, i.e. the first of the two expected interrupts, and in S220the value from S216 is therefore copied into the variable PWM_Start. IfSM is greater than 2, however, then the interrupt sensed is already thesecond interrupt, execution leaves S218 via the No branch, and in S222further interrupts are blocked.

[0116] Following S220, in S224 the value of SM is increased by 2.Likewise, following S222, in S226 the value of SM is increased by 2. Forexample, at S224 the value SM=1 is increased to SM=3, and at S226 SM=3is increased to SM=5, if period length T was being measured.

[0117] If pulse length t or off-time length t′ was being measured,however, then in S224 the value SM=2 is raised to SM=4, and in S226 thevalue SM=4 is increased to SM=6. After S226 the routine then goes toS228 Return.

[0118] Following S224, two special cases are dealt with. S230 askswhether SM is now equal to 4. This means that in the context of ameasurement of pulse length t or off-time length t′, the secondinterrupt is expected next, i.e. in FIG. 10 execution is, for example,in interrupt 146, and interrupt 150 is expected next. If No, the programgoes directly to S228 Return. If Yes, the interrupt must be the secondone, and the program goes to S232 which asks whether Flag PM=1. Aresponse of Yes means measurement of the pulse length, i.e. the lengthof a pulse 69 is presently being measured. At S234 (Interruptsensitivity=falling edge), the sensitivity of input 67 (FIG. 1) istherefore switched over to a falling edge.

[0119] If, as depicted in FIG. 11, pulse 69′ is very narrow (only a fewμs), a second interrupt cannot be generated, as described with referenceto FIG. 11. S236 therefore checks whether signal 68 has already assumeda value of 0. This is depicted graphically in FIG. 11a: if pulse 69′ hasalready ended, then signal 68=Low and the second interrupt was missed.In this case SM=8 (Error) is set in S238, the interrupt is blocked atS240, and at S242 FlagPM=0 is set, i.e. execution is switched over tooff-time measurement since the pulses are too short for measurement.S228 then follows.

[0120] If, however, signal 68=1 in S236, then the situation is asdepicted in FIG. 10, i.e. it is found at time t₀₂ that signal 68=High,the program goes directly to S228, and the measurement is continued.

[0121] If FlagPM=0 in S232 (off-time measurement), step S244 then checkswhether the off-time has already ended. This is depicted in FIG. 12,where at the end of interrupt 154 (at time t₀₅) signal 68 is alreadyHigh again, i.e. the second interrupt was missed.

[0122] If signal 68=0 in S244, the program goes directly to S228. If theresponse in S244 is Yes, then in S246 SM=8 (Error) is set, in S250 theinterrupt at input 67 is blocked, and in S252 execution is switched overto FlagPM =1, i.e. to pulse measurement, since the off-times have becometoo short and can no longer be measured.

[0123]FIG. 19 shows the “Meas. Signal” routine S202 for signal sensing.SM=1 if period length T is being sensed, and SM=2 if pulse length oroff-time length is being sensed. For SM=1, the sensitivity of input 67is set to a rising edge in S264 (Interrupt sensitivity=rising edge). IfSM=2, step S266 checks whether FlagPM =0, meaning off-time measurement.If Yes, the sensitivity of input 67 is set in S268 (Interruptsensitivity=falling edge) to a falling edge, i.e. to the beginning of anoff-time measurement.

[0124] If the response in S266 is No, a pulse measurement then follows,the previously set sensitivity (rising edge) is retained without change,and the program goes (as it does after S264 and S268) to S272, where aTimeout variable is set to a determined value, in this case 150. Thisvariable is then decremented in a wait loop. Each loop requires, forexample, 10 μs, and since it is cycled through 150 times, the maximumdelay time is 1500 microseconds=1.5 milliseconds. This is sufficient fordependable sensing of a signal 68 having a frequency of 2000 Hz, i.e. aperiod length T of 0.5 ms.

[0125] Since sensing can begin at random at any point in time withinsignal 68, allowance must be made for the possibility that measurementof the first edge was just missed, so the duration of the wait loop mustbe at least 2×0.5 ms, or 3×0.5 ms=1.5 ms including a safety factor.

[0126] At S274, an interrupt by the HALL signal (FIG. 1) is thentemporarily blocked, since no change in the HALL signal is to beexpected during the routine shown in FIG. 19. At S276 and S278 theinterrupt at input 67 is prepared and activated, and the program thengoes into the aforementioned wait loop and awaits the arrival of theinterrupt. This is done using interrupt routine S210, already describedwith reference to FIG. 18, which is triggered by the signal edge thatwas set in S212, S264, or S268.

[0127] S280 checks whether the aforesaid timeout time of, for example,1.5 ms has elapsed. If it has not yet elapsed, the program goes to stepS282 (Decrement timeout) where the Timeout variable is decremented ateach pass.

[0128] During this period—at whatever points in time—two interruptroutines according to FIG. 18 are executing successively, therebyadvancing the state machine (by means of step S224 or S226 of FIG. 18)either to SM=5 or to SM=6. This is checked at each pass in S284, and ifsuch is the case, the program leaves the wait loop and goes to S286,where further interrupts at input 67 are blocked and, at S288, theblocked Hall interrupt is unblocked again.

[0129] If it is found in step S280 that Timeout=0 before all theinterrupts have occurred, an inquiry is made as to the cause. Thisinvolves firstly, in S290, blocking input 67 (FIG. 1) for interrupts.S292 then checks whether SM has one of the values 3, 4, 5, or 6, whichare explained in FIG. 13. If so, the interrupt routine (FIG. 8) hasdetected only a first interrupt but not the second. SM=8 (Error) istherefore set in S294, the measurement is not used, and a newmeasurement begins. The program then goes to S284 and from there toS286, etc.

[0130] If the response in S292 is No, then SM must be equal to 1 or 2,i.e. after 1.5 ms the program is still waiting for the first interrupt.This is the situation according to FIG. 8 or 9, i.e. signal 68 at input67 is either continuously high, corresponding to a PWM=100%, orcontinuously low, corresponding to a PWM=0%. This is checked in S296,and if signal 68 has a value of 1, then in S298 execution switches overto FlagPM=1, i.e. to pulse measurement.

[0131] If signal 68 has a value of 0 in S296, execution switches in S300to FlagPM=0, i.e. to off-time measurement. Subsequent to S298 or S300 atS302, the state machine is set to SM=7. The program then continues viaS284 to S286 and S288.

[0132] Subsequent to S288, in S304, the new PWM value NewPVal iscalculated from the values PWM_End and PWM_Start that were stored duringthe two interrupt routines, as follows:

NewPVal=PWM_End−PWM_Start   (3).

[0133] This new value can be period length T, or pulse length t, oroff-time t′, depending on which value was measured previously. This ischecked in the subsequent steps. This involves checking in S306 whetherSM=5. That means completion of a measurement of period length T, i.e.the new value is period length T. If that is the case, then in S308 thenew PWM value NewPVal is therefore stored as a new period length T, andin S310 the new value SM=2 is stored in the state machine, as alsoindicated in FIG. 17.

[0134]FIG. 20 shows, using an example, how the data ascertained arefurther evaluated in the EVAL routine S204. The target value is firstnormalized to an 8-bit value NorPVal, corresponding to the value rangeof an 8-bit variable. As a result, it has a value in a range from 0 to255, 0 corresponding to a pulse duty factor of 0% and 255 to a pulseduty factor of 100%. Any other normalizations are of course alsopossible, e.g. 255=0% and 0=100% pulse duty factor, as are larger valueranges such as 0 to 1023. This will depend, for example, on particularrequirements and on the accuracy of the rotation speed controller thatis used.

[0135] In FIG. 20, step S322 checks whether the new PWM value NewPVal(from S304) is longer than period length T. If so, the measurement wasinaccurate, but it can be stated with certainty that pulse length t (oroff-time length t′, in the case of an off-time measurement) was almostas long as T. If the response in S322 is Yes, the program goes to S324where the normalized (i.e. standardized according to a fixed rule)setpoint NorPVal is set on a preliminary basis to 255, withoutcalculation. This definition in S324 is appropriate, however, only if ameasurement of pulse length t was being performed at the time. S326therefore then checks whether FlagPM=1. If No, then the value inquestion was an off-time measurement, and the normalized value NorPValis then set in S328 to

255−255=0.

[0136] S322 also asks whether the state machine has the value SM=7. Thisimplies one of the two situations according to FIG. 8 or 9. In this caseas well, the program goes to S324 and sets the normalized target(setpoint) value NorPVal in preliminary fashion to 255. If an off-timemeasurement was made, that preliminary value is then corrected to 0 inthe same fashion using steps S326 and S328.

[0137] If the response in S322 is No, the program goes to S328A, where apreliminary calculation is made:

NorPVal=(255*NewPVal)/T   (4).

[0138] For example, if the new PWM value NewPVal is 100 μs and T=300 μs,then the preliminary normalized value NorPVal is

255*100/300=85.

[0139] This value is applicable only to a pulse measurement. S326therefore once again checks whether a pulse measurement or an off-timemeasurement was made, and in the latter case the normalized valueNorPVal is corrected in S328. The value calculated in the example was85, and if this refers to an off-time measurement it is corrected to

255−85=170,

[0140] i.e. the normalized PWM value NorPVal would then be 170.

[0141] The program then checks whether, in the context of the measuredperiodic pulses 68, pulse length t is greater than off-time length t′ orvice versa, and the measurement method is adapted accordingly. For apulse measurement (Yes in S326) the program therefore goes to a stepS330 which checks whether the normalized PWM value NorPVal is less than120, meaning that the pulse length is less than 46% of period length T.If Yes, then in S332 execution switches over to off-time measurement,i.e. FlagPM=0. The program then goes to step S334 where SM=1 is set,i.e. the state machine is reset to “T_Start” (as also depicted in FIG.17 at S334) so that a new target value calculation begins again at SM=1.The program then goes to S336 (Return).

[0142] Following S328, S338 checks whether the off-time length isgreater than the pulse length. This involves checking whether thenormalized PWM value NorPVal calculated in S328A is greater than 132,i.e. greater than 51% of period length T. If No, the measurement typeremains unchanged (just as at S330). If Yes, then in S340 executionswitches over to pulse measurement, i.e. FlagPM=1. The program then alsogoes to steps S334 and S336, the measurement is completed, and a targetvalue is available in the form of a normalized PWM value NorPVal that(in this example) can have a value in the range from 0 to 255, and thatdefines the rotation speed.

[0143] NorPVal is compared with the value 120 in step S330, and with thevalue 132 in step S338. This results in a switching hysteresis, i.e. fora pulse duty factor between 46 and 51% both types of measurement—pulseor off-time—can take place.

[0144] The present invention can also be used to make numbers from 0 to255, contained in coded fashion in a pulse train, readable. In anelectronically commutated motor, calculation of the target value ispreferably performed in such a way that calculation is distributed amongseveral rotation positions of the motor. The reason is that thiscalculation requires a great deal of time, and therefore might interferewith other operations in the motor—especially with commutation—if thecalculation were performed in “concentrated” fashion, i.e. all at once.

[0145] Automatically switching the measurement method to pulsemeasurement or to off-time measurement yields higher accuracy, andhigher frequencies can be measured. The automatic error detectionexplained with reference to FIGS. 10 through 12 allows incorrectmeasurement results to be discarded and, in the cases described therein,permits a quick switchover to a better measurement method (as describedin FIG. 18) so that a new and better target value can then be obtainedquickly.

[0146] Many variants and modifications are of course possible within thescope of the present invention.

What is claimed is:
 1. A method of determining a numerical value for theduration of a periodically repeating pulsed signal (68), comprising thesteps of: a) determining, at time intervals, the period length (T) ofthe signal; b) determining, at time intervals, a characteristicmagnitude (t; t′) for the length of a pulse of that signal (68) is; c)ascertaining, from the period length (T) and the characteristicmagnitude (t; t′), a numerical value (NorPVal) that characterizes thesignal (68).
 2. The method according to claim 1, wherein thecharacteristic magnitude for the length of a pulse is determined as afunction of the magnitude of the numerical value (NorPVal) for the ratiobetween the length of the pulsed signal and the period length, whichnumerical value was calculated in at least one previous calculation(FIG. 20).
 3. The method according to claim 2, further comprising, whenthe pulse length (t) falls below a predetermined first percentage of theperiod length (T), determining a the time interval (t′) between twosuccessive pulses as the characteristic magnitude for the length of apulse.
 4. The method according to claim 2, wherein when the pulse lengthexceeds a predetermined second percentage of the period length (T), theduration (t) of the pulse is determined as the characteristic magnitudefor the length of a pulse.
 5. The method according to claim 3, whereinthe predetermined second percentage is greater than the predeterminedfirst percentage.
 6. The method according to claim 1, wherein fordetermination of the period length (T) or the characteristic magnitude(t; t′), at a first signal edge at the beginning of a time span to bemeasured, a first interrupt that includes a first time measurement (t₀₁)is generated; and at a second signal edge at the end of the time span tobe measured, a second interrupt (FIG. 10: 150) is generated thatincludes a second time measurement (t₀₃).
 7. The method according toclaim 6, wherein a value (t) for the characteristic magnitude (NorPVal)is calculated from a time difference between the second time measurement(t₀₃) and first time measurement (t₀₁).
 8. The method according to claim6, wherein in the course of the first interrupt a check is made as towhether the signal (68) to be measured has changed during that interruptin such a way that the second signal edge has already occurred.
 9. Themethod according to claim 6, wherein, when it is found during the firstinterrupt that the second signal edge (148′) has already occurred, thecharacteristic magnitude is subsequently determined according to adifferent measurement method.
 10. The method according to claim 6,wherein values (SM=1, 2, . . . ) of a state machine (FIG. 13) areassociated with the procedure of determining the period length (T) andthe characteristic magnitude (t; t′).
 11. The method according to claim10, further comprising checking whether predetermined criteria have beensatisfied and, if so, increasing a value in the state machine.
 12. Themethod according to claim 10, wherein the execution of at least oneprogram routine is controlled by the instantaneous state of the statemachine.
 13. A motor which comprises computer programming means that areconfigured to carry out the steps according to claim
 1. 14. A motoraccording to claim 13 further comprising a rotation speed controllerhaving an input which receives a numerical value, the numerical valueserving to determine the rotation speed to which the rotation speedcontroller regulates the rotation speed of the motor.
 15. The motoraccording to claim 14, wherein the computer program means areimplemented so that the determination of the numerical value isdistributed among a plurality of rotational position regions of themotor.
 16. An arrangement for determining a numerical value for theduration of a periodically repeating pulsed signal (68), comprising anapparatus that, at time intervals, determines the period length (T) ofthe signal; that furthermore, at time intervals, determines acharacteristic magnitude for the length of a pulse of that signal (68);and that ascertains, from the period length (T) and the characteristicmagnitude (t; t′), a numerical value which characterizes the signal(68).
 17. The arrangement according to claim 16, wherein the apparatusis configured to determine the characteristic magnitude (t; t′) for thelength of a pulse as a function of the magnitude of the numerical value(NorPVal) for the ratio between the length (t) of the pulsed signal andthe period length (T), which numerical value (NorPVal) was calculated inat least one previous calculation.
 18. The arrangement according toclaim 17, wherein the apparatus is configured to determine, as afunction of the ratio between pulse length (t) and period length (T)when that ratio falls below a predetermined first value, the timeinterval (t′) between two successive pulses as a magnitudecharacterizing the length of a pulse.
 19. The arrangement according toclaim 17 wherein the apparatus is configured to determine, as a functionof the ratio between pulse length (t) and period length (T), when thatratio exceeds a predetermined second value, the duration (t) of thepulse as the characteristic magnitude for the length of a pulse.
 20. Thearrangement according to claim 18 wherein the predetermined second valueis greater than the predetermined first value.
 21. The arrangementaccording to claim 16, which, in order to determine the period length(T) or the characteristic magnitude (t; t′), is configured to generate,at a first signal edge at the beginning of a time span to be measured, afirst interrupt (FIG. 10: 146) that includes a first time measurement(t₀₁); and to generate, at a second signal edge at the end of the timespan to be measured, a second interrupt (FIG. 10: 150) that includes asecond time measurement (t₀₃).
 22. The arrangement according to claim 21which is configured to calculate a value (t) for the characteristicmagnitude from the time difference between the second time measurement(t₀₃) and first time measurement (t₀₁).
 23. The arrangement according toclaim 21 which is configured to check, in the course of the firstinterrupt whether the signal (68) to be measured has changed during thatinterrupt in such a way that the second signal edge has alreadyoccurred.
 24. The arrangement according to claim 21 which is configuredto check, during the first interrupt, whether the second signal edge(148′) has already occurred, and if so to determine the characteristicmagnitude subsequently according to a different measurement method. 25.The arrangement according to claim 16, wherein a state machine (FIG. 13)is provided which reflects in its instantaneous values the sequence ofdetermining the period length (T) and the characteristic magnitude (t;t′).
 26. The arrangement according to claim 25 which is configured toincrease the instantaneous value in the state machine after certaincriteria are met (FIG. 18: S224, S226).
 27. The arrangement according toclaim 25 wherein the execution of at least one program routine iscontrolled by an instantaneous state of the state machine.